package controladores;

import java.io.Serializable;

import modelo.Registo;
import modelo.Utilizador;

import com.example.rm.teste.R;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

public class Resumo extends MenuPrincipal implements Serializable {
	public static final String registsLidos = "registos";
	Integer idRegisto;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_resumo);
		
		idRegisto = (Integer) getIntent().getSerializableExtra(Hist.registsLidos);
		Registo r = estruturasLer.obterRegisto(idRegisto, getApplicationContext());
		Utilizador u = estruturasLer.obterUtilizador(r.idPessoa, getBaseContext());
		TextView data = (TextView) findViewById(R.id.textViewResumoData2);
		data.setText(r.data.toString());
		
		TextView avaliacao = (TextView) findViewById(R.id.textViewResumoAvaliacao1);
		avaliacao.setText(r.avalacao.toString());
		
		TextView sis = (TextView) findViewById(R.id.textViewResumoSistolica1);
		sis.setText(String.valueOf(r.sistolica));
		
		TextView dias = (TextView) findViewById(R.id.textViewResumoDiastolica1);
		dias.setText(String.valueOf(r.diastolica));
	
		TextView hora = (TextView) findViewById(R.id.textViewResumoHora1);
		hora.setText(r.hora.toString());
		
		TextView puls = (TextView) findViewById(R.id.textViewResumoPulsacao1);
		puls.setText(String.valueOf(r.pulsacao));
		
		TextView com = (TextView) findViewById(R.id.textViewResumoComentarios1);
		com.setText(r.comentario.toString());
		
		TextView user = (TextView) findViewById(R.id.textViewResumoUtilizador);
		user.setText("Utilizador: "+ u.getNome().toString());
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.resumo, menu);
		return true;
	}

	
	
	
	public void onClickOK(View v){
		Intent intent2 = new Intent(getApplicationContext(), Hist.class);
		startActivity(intent2);
		
	}
	
	public void onClickEditar(View v){
		Intent intent3 = new Intent(getApplicationContext(), EditarRegisto.class);
		intent3.putExtra(estruturasLidas, estruturasLer);
		intent3.putExtra(registsLidos, idRegisto);
		startActivity(intent3);
		
	}
	
	
	
	

}
